package ymr.gui;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Rectangle;


import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
 * Tile as a panel which will be added to frame (to window)
 * @author Tuuli
 *
 */
public class TileGUI extends JPanel{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3363920249554605561L;
	private int coordx = 0;
	private int coordy = 0;
	private int diameter = 50;
	private String name;

	
	
	
	public TileGUI(String name){
		super();
		this.name = name;
		setSize(50, 50);
		setPreferredSize(getSize());
		setBackground(Color.white);
		
		
	}
	
	@Override
	/**
	 * draw rectangle and place it's name (order in game) on top of it
	 */
	public void paintComponent(Graphics g){
		super.paintComponent(g);
		g.setColor(Color.blue);
		g.drawRect(coordx, coordy, diameter, diameter);
		g.setColor(Color.yellow);
		g.fillRect(coordx, coordy, diameter, diameter);
		g.setColor(Color.black);
		g.drawString(name, coordx, coordy+10);
		
	}

}
